home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 356 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1000 b   |  38 lines

  1. Path: rcp6.elan.af.mil!rscernix!danpop
  2. From: danpop@mail.cern.ch (Dan Pop)
  3. Newsgroups: comp.std.c
  4. Subject: Is a diagnostic required?
  5. Date: 22 Feb 96 14:35:40 GMT
  6. Organization: CERN European Lab for Particle Physics
  7. Message-ID: <danpop.824999740@rscernix>
  8. NNTP-Posting-Host: ues5.cern.ch
  9. X-Newsreader: NN version 6.5.0 #7 (NOV)
  10.  
  11. Hi,
  12.  
  13. Does the following code require a diagnostic?
  14.  
  15.     foo()
  16.     {
  17.     }
  18.  
  19.     main()
  20.     {
  21.     foo(3);
  22.     }
  23.  
  24. I was always convinced that there is no difference between foo() and
  25. foo(void) in the _definition_ of the function foo and that 'void' as the
  26. argument list of a function was introduced for function declarations,
  27. because an empty argument list in a function declaration had to be
  28. treated as in K&R C.  Yet, all the compilers I tried accepted this code
  29. without complaint and complained when 'void' was introduced in the
  30. definition of foo.
  31.  
  32. Dan
  33. --
  34. Dan Pop
  35. CERN, CN Division
  36. Email: danpop@mail.cern.ch 
  37. Mail:  CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
  38.